using System;
using System.Collections;
namespace BMC.ARSystem
{
	internal abstract class ARXDataTypeWriter
	{
		protected static Hashtable factoryMap;
		internal abstract string WriteValue(object obj);
		static ARXDataTypeWriter()
		{
			ARXDataTypeWriter.factoryMap = new Hashtable();
			ARXDataTypeWriter.factoryMap.Add("CHAR", new ARXCharWriter());
			ARXDataTypeWriter.factoryMap.Add("ATTACH", new ARXAttachmentWriter());
			ARXDataTypeWriter.factoryMap.Add("TIME", new ARXTimeWriter());
			ARXDataTypeWriter.factoryMap.Add("CURRENCY", new ARXCurrencyWriter());
			ARXDataTypeWriter.factoryMap.Add("DATE", new ARXIntegerWriter());
			ARXDataTypeWriter.factoryMap.Add("TIMEOFDAY", new ARXIntegerWriter());
			ARXDataTypeWriter.factoryMap.Add("INTEGER", new ARXIntegerWriter());
			ARXDataTypeWriter.factoryMap.Add("ENUM", new ARXEnumWriter());
			ARXDataTypeWriter.factoryMap.Add("REAL", new ARXRealWriter());
			ARXDataTypeWriter.factoryMap.Add("DECIMAL", new ARXDecimalWriter());
			ARXDataTypeWriter.factoryMap.Add("DIARY", new ARXDiaryWriter());
		}
		internal static string GetDataTypeString(uint dataType)
		{
			switch (dataType)
			{
			case 2u:
				return "INTEGER";
			case 3u:
				return "REAL";
			case 4u:
				return "CHAR";
			case 5u:
				return "DIARY";
			case 6u:
				return "ENUM";
			case 7u:
				return "TIME";
			case 10u:
				return "DECIMAL";
			case 11u:
				return "ATTACH";
			case 12u:
				return "CURRENCY";
			case 13u:
				return "DATE";
			case 14u:
				return "TIMEOFDAY";
			}
			return "U";
		}
		internal static ARXDataTypeWriter CreateWriter(string dataType)
		{
			if (dataType != "U" && !ARXDataTypeWriter.factoryMap.ContainsKey(dataType))
			{
				throw new Exception("ARXDataTypeWriter not defined for type " + dataType);
			}
			return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item(dataType);
		}
		internal static ARXDataTypeWriter CreateWriter(uint dataType)
		{
			switch (dataType)
			{
			case 2u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("INTEGER");
			case 3u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("REAL");
			case 4u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("CHAR");
			case 5u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("DIARY");
			case 6u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("ENUM");
			case 7u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("TIME");
			case 10u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("DECIMAL");
			case 11u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("ATTACH");
			case 12u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("CURRENCY");
			case 13u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("DATE");
			case 14u:
				return (ARXDataTypeWriter)ARXDataTypeWriter.factoryMap.get_Item("TIMEOFDAY");
			}
			throw new Exception("ARXDataTypeWriter not defined for type " + dataType);
		}
	}
}
